unit Reguleringu;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Spin, StdCtrls, Buttons, ExtCtrls;

type
  TfrmRegulering = class(TForm)
    gpbPHindstillinger: TGroupBox;
    SpeedButton1: TSpeedButton;
    gpbRegMeth: TGroupBox;
    btnpH: TSpeedButton;
    btnTemp: TSpeedButton;
    btnOxygen: TSpeedButton;
    btnFeed: TSpeedButton;
    btnLight: TSpeedButton;
    btnAlt1: TSpeedButton;
    btnAlt2: TSpeedButton;
    gpbRegpH: TGroupBox;
    gpbActive: TGroupBox;
    gpbTRpH: TGroupBox;
    speOOpH: TSpeedButton;
    speDPpH: TSpeedButton;
    spePIDph: TSpeedButton;
    speFBpH: TSpeedButton;
    gpbSetpoints: TGroupBox;
    gpbDPrest: TGroupBox;
    gpbTempSettings: TGroupBox;
    SpeedButton2: TSpeedButton;
    gpbRegTemp: TGroupBox;
    GroupBox6: TGroupBox;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    SpeedButton5: TSpeedButton;
    SpeedButton6: TSpeedButton;
    GroupBox8: TGroupBox;
    Label5: TLabel;
    GroupBox9: TGroupBox;
    Label6: TLabel;
    edtTEMPsetpoint: TEdit;
    edtTempTidsforsinkelse: TEdit;
    edtTidsforsinkelse: TEdit;
    lblPHtidsforsinkelse: TLabel;
    edtPHTimerInterval: TEdit;
    lblpHvolumen: TLabel;
    edtPHsyreTimerInterval: TEdit;
    lblVolumenSyre: TLabel;
    lblPHsetpoint: TLabel;
    edtPHsetpoint: TEdit;
    edtPHMaxSetpoint: TEdit;
    lblMaxSetpointPH: TLabel;
    gpbFeedSettings: TGroupBox;
    SpeedButton7: TSpeedButton;
    GroupBox10: TGroupBox;
    gpbRegFeed: TGroupBox;
    GroupBox17: TGroupBox;
    speFeedOO: TSpeedButton;
    speFeedDP: TSpeedButton;
    SpeedButton10: TSpeedButton;
    SpeedButton11: TSpeedButton;
    gpbFeedDPSet: TGroupBox;
    gpbFeedDPA: TGroupBox;
    lblMetSetpoint: TLabel;
    edtMetSetpoint: TEdit;
    gpbFeedOOSet: TGroupBox;
    edtMetTimerInterval: TEdit;
    lblMetVolumen: TLabel;
    edtMetTidsforsinkelse: TEdit;
    lblMetTidsforsinkelse: TLabel;
    gpbFeedOOA: TGroupBox;
    lblFlow: TLabel;
    edtFlowHastighed: TEdit;
    gpbOxySettings: TGroupBox;
    SpeedButton12: TSpeedButton;
    gpbRegOxy: TGroupBox;
    GroupBox19: TGroupBox;
    SpeedButton13: TSpeedButton;
    SpeedButton14: TSpeedButton;
    SpeedButton15: TSpeedButton;
    SpeedButton16: TSpeedButton;
    gpbIltIndstillinger: TGroupBox;
    lblIltKp: TLabel;
    lblIltTidsforsinkelse: TLabel;
    lblIltNormalOutput: TLabel;
    lblMinRPM: TLabel;
    lblMaxRPM: TLabel;
    edtIltKp: TEdit;
    edtIltTidsforsinkelse: TEdit;
    edtIltNormalOutput: TEdit;
    edtRPMmin: TEdit;
    edtRPMmax: TEdit;
    gpbLigSettings: TGroupBox;
    SpeedButton17: TSpeedButton;
    GroupBox18: TGroupBox;
    gpbRegLig: TGroupBox;
    GroupBox22: TGroupBox;
    SpeedButton18: TSpeedButton;
    SpeedButton19: TSpeedButton;
    SpeedButton20: TSpeedButton;
    SpeedButton21: TSpeedButton;
    gpbAlt1Settings: TGroupBox;
    SpeedButton22: TSpeedButton;
    gpbOpt1: TGroupBox;
    grbOpt1_typeReg: TGroupBox;
    gpbAlt2Settings: TGroupBox;
    SpeedButton27: TSpeedButton;
    edtFeedOODelay: TEdit;
    Label19: TLabel;
    edtILTTi: TEdit;
    edtILTTd: TEdit;
    lblIltTi: TLabel;
    lblILTTd: TLabel;
    grpIltSetpoint: TGroupBox;
    edtILTsetpointMin: TEdit;
    lblILTsetpoint: TLabel;
    cbIltKp: TCheckBox;
    cbIltTi: TCheckBox;
    cbIltTd: TCheckBox;
    btnIltAdv: TButton;
    grbOpt1_OnOf_setpoints: TGroupBox;
    grbOpt1_OnOf_parameters: TGroupBox;
    lblOpt1_onof_timedelay: TLabel;
    edtOpt1_onof_timedelay: TEdit;
    grbOpt1_DoPa_parameters: TGroupBox;
    lblOpt1_DoPa_RegPause: TLabel;
    lblOpt1_DoPa_DoseSize: TLabel;
    edtOpt1_DoPa_RegPause: TEdit;
    edtOpt1_DoPa_DoseSize: TEdit;
    grbOpt1_DoPa_setpoints: TGroupBox;
    grbOpt1_PID_parameters: TGroupBox;
    lblOpt1_PID_kp: TLabel;
    lblOpt1_PID_timedelay: TLabel;
    lblOpt1_PID_normal: TLabel;
    lblOpt1_PID_minvalue: TLabel;
    lblOpt1_PID_maxvalue: TLabel;
    lblOpt1_PID_ti: TLabel;
    lblOpt1_PID_td: TLabel;
    edtOpt1_PID_kp: TEdit;
    edtOpt1_PID_TimeDelay: TEdit;
    edtOpt1_PID_normal: TEdit;
    edtOpt1_PID_maxvalue: TEdit;
    edtOpt1_PID_minvalue: TEdit;
    edtOpt1_PID_ti: TEdit;
    edtOpt1_PID_td: TEdit;
    cbOpt1_PID_kp: TCheckBox;
    cbOpt1_PID_ti: TCheckBox;
    cbOpt1_PID_td: TCheckBox;
    btnOpt1_PID_AdvSet: TButton;
    grbOpt1_PID_setpoint: TGroupBox;
    lblOpt1_PID_setpoints: TLabel;
    edtOpt1_PID_setpoints: TEdit;
    grbOpt1_Feedback_parameters: TGroupBox;
    grbOpt1_Feedback_setpoints: TGroupBox;
    speOpt1_typeReg_OnOf: TSpeedButton;
    speOPt1_typeReg_DoPa: TSpeedButton;
    speOpt1_TypeReg_PID: TSpeedButton;
    speOpt1_TypeReg_Feed: TSpeedButton;
    edtOpt1_Feedback_parameters_normal: TEdit;
    edtOpt1_Feedback_parameters_IncrementsSize: TEdit;
    lblOpt1_Feedback_parameters_normal: TLabel;
    lblOpt1_Feedback_parameters_IncrementSize: TLabel;
    gpbRegAlt2: TGroupBox;
    grbOpt2_PID_setpoint: TGroupBox;
    lblOpt2_PID_setpoint: TLabel;
    edtOpt2_PID_setpoint: TEdit;
    grbOpt2_typereg: TGroupBox;
    speOpt2_typereg_onof: TSpeedButton;
    speOpt2_typereg_dopa: TSpeedButton;
    speOpt2_typereg_PID: TSpeedButton;
    speOpt2_typereg_feedback: TSpeedButton;
    grbOpt2_PID_parameters: TGroupBox;
    lblOpt2_PID_parameters_kp: TLabel;
    lblOpt2_PID_parameters_timedelay: TLabel;
    lblOpt2_PID_parameters_normal: TLabel;
    lblOpt2_PID_parameters_minvalue: TLabel;
    lblOpt2_PID_parameters_maxvalue: TLabel;
    lblOpt2_PID_parameters_ti: TLabel;
    lblOpt2_PID_parameters_td: TLabel;
    edtOpt2_PID_parameters_kp: TEdit;
    edtOpt2_PID_parameters_timedelay: TEdit;
    edtOpt2_PID_parameters_normal: TEdit;
    edtOpt2_PID_parameters_maxvalue: TEdit;
    edtOpt2_PID_parameters_minvalue: TEdit;
    edtOpt2_PID_parameters_ti: TEdit;
    edtOpt2_PID_parameters_td: TEdit;
    chOpt2_PID_parameters_kp: TCheckBox;
    chOpt2_PID_parameters_ti: TCheckBox;
    chOpt2_PID_parameters_td: TCheckBox;
    btnOpt2_PID_parameters_adv: TButton;
    grbOpt2_onof_parameter: TGroupBox;
    lblOpt2_onof_parameter_timedelay: TLabel;
    edtOpt2_onof_parameter_timedelay: TEdit;
    grbOpt2_onof_setpoints: TGroupBox;
    grbOpt2_dopa_parameters: TGroupBox;
    lblOpt2_dopa_parameters_pause: TLabel;
    lblOpt2_dopa_parameters_dosesize: TLabel;
    edtOpt2_dopa_parameters_pause: TEdit;
    edtOpt2_dopa_parameters_dosesize: TEdit;
    grbOpt2_dopa_setpoints: TGroupBox;
    grbOpt2_Feedback_setpoint: TGroupBox;
    grbOpt2_Feedback_Parameters: TGroupBox;
    lblOpt2_Feedback_parameters_normal: TLabel;
    lblOpt2_Feedback_parameters_CriticalFeed: TLabel;
    lblOpt2_Feedback_parameters_IncrementSize: TLabel;
    edtOpt2_Feedback_parameters_normal: TEdit;
    edtOpt2_Feedback_parameters_CriticalFeed: TEdit;
    edtOpt2_Feedback_parameters_IncrementsSize: TEdit;
    Label21: TLabel;
    cboOpt2_Feedback_setpoints_GreatLess: TComboBox;
    edtOpt2_Feedback_setpoint: TEdit;
    Label20: TLabel;
    Label18: TLabel;
    cboOpt2_DoPa_setpoints_GreatLess: TComboBox;
    edtOpt2_dopa_setpoints: TEdit;
    Label17: TLabel;
    Label15: TLabel;
    cboOpt2_OnOf_setpoints_GreatLess: TComboBox;
    edtOpt2_onof_setpoints: TEdit;
    Label16: TLabel;
    lblOpt1_Feedback_setpoint_text2: TLabel;
    edtOpt1_Feedback_setpoint: TEdit;
    cboOpt1_Feedback_setpoint_GreatLess: TComboBox;
    lblOpt1_Feedback_setpoint_text1: TLabel;
    lblOpt1_OnOf_setpoint_text2: TLabel;
    edtOpt1_OnOf_setpoint: TEdit;
    cboOpt1_OnOf_setpoint_GreatLess: TComboBox;
    lblOpt1_OnOf_setpoint_text1: TLabel;
    lblOpt1_DoPa_setpoint_text2: TLabel;
    edtOpt1_DoPa_setpoints: TEdit;
    cboOpt1_DoPa_setpoint_GreatLess: TComboBox;
    lblOpt1_DoPa_setpoint_text1: TLabel;
    grbLight_parameters: TGroupBox;
    Label22: TLabel;
    Label25: TLabel;
    edtLight_parameters_normal: TEdit;
    edtLight_parameters_IncrementSize: TEdit;
    grbLight_setpoints: TGroupBox;
    gpbOvervaagningPH: TGroupBox;
    radOVPHOn: TRadioButton;
    radOVPHoff: TRadioButton;
    gpbReguleringPH: TGroupBox;
    radPHoff: TRadioButton;
    radPHon: TRadioButton;
    lblPHrel: TLabel;
    sedPHrel: TSpinEdit;
    lblPHchannel: TLabel;
    sedPHchannel: TSpinEdit;
    gpbReguleringSyre: TGroupBox;
    lblRelSyre: TLabel;
    SpeedButton23: TSpeedButton;
    radPHsyreOff: TRadioButton;
    radPHsyreON: TRadioButton;
    sedPHsyreRel: TSpinEdit;
    sbtnpH_Calibration_input: TSpeedButton;
    SpeedButton9: TSpeedButton;
    GroupBox7: TGroupBox;
    radTEMPon: TRadioButton;
    radTEMPoff: TRadioButton;
    GroupBox5: TGroupBox;
    radOVTempOn: TRadioButton;
    radOVTempOff: TRadioButton;
    sedTEMPchannel: TSpinEdit;
    Label1: TLabel;
    Label2: TLabel;
    SpeedButton8: TSpeedButton;
    sedTempRel: TSpinEdit;
    gpbOvervaagningIlt: TGroupBox;
    radOVIltOn: TRadioButton;
    radOVIltOff: TRadioButton;
    gpbReguleringIlt: TGroupBox;
    radILToff: TRadioButton;
    radILTon: TRadioButton;
    sedILTchannel: TSpinEdit;
    lblILTchannel: TLabel;
    lblIltChannelOut: TLabel;
    SpeedButton25: TSpeedButton;
    speOxyAnalog: TSpeedButton;
    edtChOut: TEdit;
    GroupBox15: TGroupBox;
    radMetOn: TRadioButton;
    radMetOff: TRadioButton;
    sedMetRel: TSpinEdit;
    Label9: TLabel;
    Label3: TLabel;
    SpeedButton29: TSpeedButton;
    GroupBox23: TGroupBox;
    radLight_settings_regOf: TRadioButton;
    radLight_settings_regOn: TRadioButton;
    Label8: TLabel;
    Edit1: TEdit;
    Label4: TLabel;
    SpeedButton30: TSpeedButton;
    grbAlt1Settings_Reg: TGroupBox;
    rbAlt1Settings_RegOff: TRadioButton;
    rbAlt1Settings_RegOn: TRadioButton;
    grbAlt1Settings_Mon: TGroupBox;
    rbAlt1Settings_MonOn: TRadioButton;
    rbAlt1Settings_MonOff: TRadioButton;
    lblAlt1Settings_Input_ch: TLabel;
    sedtAlt1Settings_Input_ch: TSpinEdit;
    sedtAlt1Settings_Output_ch: TSpinEdit;
    lblAlt1Settings_Output_ch: TLabel;
    SpeedButton31: TSpeedButton;
    SpeedButton32: TSpeedButton;
    grbAlt2Settings_Mon: TGroupBox;
    radAlt2Settings_MonOn: TRadioButton;
    radAlt2Settings_MonOff: TRadioButton;
    grbAlt2Settings_Reg: TGroupBox;
    radAlt2Settings_RegOff: TRadioButton;
    radAlt2Settings_RegOn: TRadioButton;
    sedAlt2Settings_Output_ch: TSpinEdit;
    lblAlt2Settings_Output_ch: TLabel;
    sedAlt2Settings_Input_ch: TSpinEdit;
    lblAlt2Settings_Input_ch: TLabel;
    SpeedButton33: TSpeedButton;
    SpeedButton34: TSpeedButton;
    Label24: TLabel;
    edtLight_parameters_CriticalFeed: TEdit;
    lblAlt1Settings_Output_ch2: TLabel;
    sbtnAlt1Settings_Output_ch2Calibration: TSpeedButton;
    edtAlt1Settings_Output_ch2: TEdit;
    lblOpt1_Feedback_parameters_DoseTimeDelay: TLabel;
    edtOpt1_Feedback_parameters_DoseTimedelay: TEdit;
    lblOpt1_Feedback_parameters_DoseSize: TLabel;
    edtOpt1_Feedback_parameters_DoseSize: TEdit;
    edtOpt1_Feedback_parameters_CriticalFeed: TEdit;
    lblOpt1_Feedback_parameters_CriticalFeed: TLabel;
    sbtnAlt2Settings_Output_ch2: TSpeedButton;
    lblAlt2Settings_Output_ch2: TLabel;
    edtAlt2Settings_Output_ch2: TEdit;
    lblOpt2_Feedback_parameters_DoseTimeDelay: TLabel;
    edtOpt2_Feedback_parameters_DoseTimedelay: TEdit;
    lblOpt2_Feedback_parameters_dosesize: TLabel;
    edtOpt2_Feedback_parameters_DoseSize: TEdit;
    grbpH_Calibration_input: TGroupBox;
    Label12: TLabel;
    Label13: TLabel;
    grbpH_Calibration_outputBase: TGroupBox;
    Label14: TLabel;
    Label23: TLabel;
    grbpH_Calibration_outputAcid: TGroupBox;
    Label26: TLabel;
    Label27: TLabel;
    grbTemp_Calibration_input: TGroupBox;
    Label28: TLabel;
    Label29: TLabel;
    grbOxygen_Calibration_input: TGroupBox;
    Label30: TLabel;
    Label31: TLabel;
    grbOxygen_Calibration_output: TGroupBox;
    Label32: TLabel;
    Label33: TLabel;
    grbFeed_Calibration_output: TGroupBox;
    Label36: TLabel;
    Label37: TLabel;
    grbLight_Calibration_output: TGroupBox;
    Label34: TLabel;
    Label35: TLabel;
    grbAlt1_Calibration_input: TGroupBox;
    Label38: TLabel;
    Label39: TLabel;
    grbAlt1_Calibration_Output1: TGroupBox;
    Label40: TLabel;
    Label41: TLabel;
    edtCust1OutH: TEdit;
    edtCust1OutS: TEdit;
    grbAlt2_Calibration_Output1: TGroupBox;
    Label46: TLabel;
    Label47: TLabel;
    edtCust2OutH: TEdit;
    edtCust2OutS: TEdit;
    grbAlt2_Calibration_input: TGroupBox;
    Label48: TLabel;
    Label49: TLabel;
    edtPHhaeldning: TEdit;
    edtPHskaering: TEdit;
    edtTempHaeldning: TEdit;
    edtTempSkaering: TEdit;
    edtIltHaeldning: TEdit;
    edtIltSkaering: TEdit;
    edtRPMhaeldning: TEdit;
    edtRPMskaering: TEdit;
    edtPumpe1haeldning: TEdit;
    edtPumpe1skaering: TEdit;
    edtPumpe2haeldning: TEdit;
    edtPumpe2skaering: TEdit;
    edtPumpe3haeldning: TEdit;
    edtPumpe3skaering: TEdit;
    edtLigthHaeldning: TEdit;
    edtLightSkaering: TEdit;
    edtAlt1Haeldning: TEdit;
    edtAlt1Skaering: TEdit;
    edtAlt2Haeldning: TEdit;
    edtAlt2Skaering: TEdit;
    panI0: TPanel;
    Label7: TLabel;
    Label10: TLabel;
    panO0: TPanel;
    panI1: TPanel;
    panO1: TPanel;
    panO3: TPanel;
    panO2: TPanel;
    panI2: TPanel;
    panI3: TPanel;
    panO5: TPanel;
    panO4: TPanel;
    panI4: TPanel;
    panI5: TPanel;
    panI6: TPanel;
    panO6: TPanel;
    panAnalog: TPanel;
    Label43: TLabel;
    Label11: TLabel;
    cbLightParameters_HistoryReset: TCheckBox;
    cbOpt1_FeedBack_parameters_HistoryReset: TCheckBox;
    Label42: TLabel;
    Label44: TLabel;
    cbOpt2_FeedBack_parameters_HistoryReset: TCheckBox;
    Label45: TLabel;
    Label50: TLabel;
    edtLight_parameters_Min: TEdit;
    edtLight_parameters_Max: TEdit;
    Label51: TLabel;
    edtOpt1_Feedback_parameters_max: TEdit;
    edtOpt1_Feedback_parameters_min: TEdit;
    Label52: TLabel;
    edtOpt2_Feedback_parameters_max: TEdit;
    Label53: TLabel;
    edtOpt2_Feedback_parameters_min: TEdit;
    Label54: TLabel;
    Label55: TLabel;
    Label56: TLabel;
    Label57: TLabel;
    Label58: TLabel;
    cbOpt1_DoPa_parameters_historyReset: TCheckBox;
    cbOpt1_DoPa_parameters_weight: TCheckBox;
    cbOpt1_DoPa_parameters_MA: TCheckBox;
    edtOpt1_DoPa_parameters_NrDP: TSpinEdit;
    procedure btnpHClick(Sender: TObject);
    procedure btnTempClick(Sender: TObject);
    procedure btnOxygenClick(Sender: TObject);
    procedure btnFeedClick(Sender: TObject);
    procedure btnLightClick(Sender: TObject);
    procedure btnAlt1Click(Sender: TObject);
    procedure btnAlt2Click(Sender: TObject);
    procedure speOpt1_typeReg_OnOfClick(Sender: TObject);
    procedure speOPt1_typeReg_DoPaClick(Sender: TObject);
    procedure speOpt1_TypeReg_PIDClick(Sender: TObject);
    procedure speOpt1_TypeReg_FeedClick(Sender: TObject);
    procedure speFeedOOClick(Sender: TObject);
    procedure speFeedDPClick(Sender: TObject);
    procedure speOpt2_typereg_onofClick(Sender: TObject);
    procedure speOpt2_typereg_dopaClick(Sender: TObject);
    procedure speOpt2_typereg_PIDClick(Sender: TObject);
    procedure speOpt2_typereg_feedbackClick(Sender: TObject);
    procedure btnOpt2_PID_parameters_advClick(Sender: TObject);
    procedure btnOpt1_PID_AdvSetClick(Sender: TObject);
    procedure btnIltAdvClick(Sender: TObject);
    procedure radLight_settings_regOnClick(Sender: TObject);
    procedure radLight_settings_regOfClick(Sender: TObject);
    procedure sbtnpH_Calibration_inputClick(Sender: TObject);
    procedure SpeedButton9Click(Sender: TObject);
    procedure SpeedButton23Click(Sender: TObject);
    procedure SpeedButton8Click(Sender: TObject);
    procedure SpeedButton25Click(Sender: TObject);
    procedure speOxyAnalogClick(Sender: TObject);
    procedure SpeedButton29Click(Sender: TObject);
    procedure SpeedButton30Click(Sender: TObject);
    procedure SpeedButton31Click(Sender: TObject);
    procedure SpeedButton32Click(Sender: TObject);
    procedure sbtnAlt1Settings_Output_ch2CalibrationClick(Sender: TObject);
    procedure SpeedButton33Click(Sender: TObject);
    procedure SpeedButton34Click(Sender: TObject);
    procedure sbtnAlt2Settings_Output_ch2Click(Sender: TObject);
    procedure radOVPHOnClick(Sender: TObject);
    procedure radOVPHoffClick(Sender: TObject);
    procedure radMetOnClick(Sender: TObject);
    procedure radMetOffClick(Sender: TObject);
    procedure radOVIltOnClick(Sender: TObject);
    procedure radOVIltOffClick(Sender: TObject);
    procedure radILTonClick(Sender: TObject);
    procedure radILToffClick(Sender: TObject);
    procedure radOVTempOnClick(Sender: TObject);
    procedure radOVTempOffClick(Sender: TObject);
    procedure radTEMPonClick(Sender: TObject);
    procedure radTEMPoffClick(Sender: TObject);
    procedure radPHonClick(Sender: TObject);
    procedure radPHoffClick(Sender: TObject);
    procedure radPHsyreONClick(Sender: TObject);
    procedure radPHsyreOffClick(Sender: TObject);
    procedure radAlt2Settings_MonOnClick(Sender: TObject);
    procedure radAlt2Settings_MonOffClick(Sender: TObject);
    procedure radAlt2Settings_RegOnClick(Sender: TObject);
    procedure radAlt2Settings_RegOffClick(Sender: TObject);
    procedure rbAlt1Settings_MonOnClick(Sender: TObject);
    procedure rbAlt1Settings_MonOffClick(Sender: TObject);
    procedure rbAlt1Settings_RegOnClick(Sender: TObject);
    procedure rbAlt1Settings_RegOffClick(Sender: TObject);
    procedure sedMetRelChange(Sender: TObject);
    procedure sedILTchannelChange(Sender: TObject);
    procedure sedTEMPchannelChange(Sender: TObject);
    procedure sedTempRelChange(Sender: TObject);
    procedure sedPHchannelChange(Sender: TObject);
    procedure sedPHrelChange(Sender: TObject);
    procedure sedPHsyreRelChange(Sender: TObject);
    procedure sedAlt2Settings_Input_chChange(Sender: TObject);
    procedure sedAlt2Settings_Output_chChange(Sender: TObject);
    procedure sedtAlt1Settings_Input_chChange(Sender: TObject);
    procedure sedtAlt1Settings_Output_chChange(Sender: TObject);
    procedure edtOpt2_onof_setpointsKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt2_onof_parameter_timedelayKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt2_Feedback_setpointKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt2_Feedback_parameters_DoseTimedelayKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt2_Feedback_parameters_DoseSizeKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt2_Feedback_parameters_CriticalFeedKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt2_Feedback_parameters_normalKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt2_Feedback_parameters_IncrementsSizeKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt2_dopa_setpointsKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt2_PID_setpointKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt2_PID_parameters_kpKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt2_PID_parameters_tiKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt2_PID_parameters_tdKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt2_PID_parameters_normalKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt2_PID_parameters_timedelayKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt2_PID_parameters_minvalueKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt2_PID_parameters_maxvalueKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt2_dopa_parameters_pauseKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt2_dopa_parameters_dosesizeKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt1_OnOf_setpointKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_onof_timedelayKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_DoPa_setpointsKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_DoPa_RegPauseKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_DoPa_DoseSizeKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_PID_setpointsKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_PID_kpKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_PID_tiKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_PID_tdKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_PID_normalKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_PID_TimeDelayKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_PID_minvalueKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_PID_maxvalueKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_Feedback_setpointKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtOpt1_Feedback_parameters_DoseTimedelayKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt1_Feedback_parameters_DoseSizeKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt1_Feedback_parameters_CriticalFeedKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt1_Feedback_parameters_normalKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtOpt1_Feedback_parameters_IncrementsSizeKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtLight_parameters_CriticalFeedKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtLight_parameters_normalKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtLight_parameters_IncrementSizeKeyUp(Sender: TObject;
      var Key: Word; Shift: TShiftState);
    procedure edtFlowHastighedKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtFeedOODelayKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtILTsetpointMinKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtIltKpKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure edtILTTiKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure edtILTTdKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure edtIltNormalOutputKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtIltTidsforsinkelseKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtRPMminKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtRPMmaxKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtTEMPsetpointKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtTempTidsforsinkelseKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtPHsetpointKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtPHMaxSetpointKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtTidsforsinkelseKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtPHsyreTimerIntervalKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edtPHTimerIntervalKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmRegulering: TfrmRegulering;
  TypedText: string;

implementation

uses unit1, AdvPID_ilt, AdvPID_Opt1, AdvPID_Opt2;

{$R *.dfm}

Procedure CheckInput;

var
  Length2, It: integer;
begin
  Length2 := length(TypedText);
  if Length2 > 0 then
    begin
      if (TypedText[Length2] = '0') or (TypedText[Length2] = '1') or (TypedText[Length2] = '2') or (TypedText[Length2] = '3') or (TypedText[Length2] = '4') or (TypedText[Length2] = '5') or (TypedText[Length2] = '6') or (TypedText[Length2] = '7') or (TypedText[Length2] = '8') or (TypedText[Length2] = '9') or (TypedText[Length2] = ',') then
      else
        begin
          showmessage('You have entered a invalid character - only "0,1,2,3,4,5,6,7,8,9 and ," is allowed.');
       end;
    end;
end;

procedure ActiveChannels;
begin
  PanI0 := 0;
  PanI1 := 0;
  PanI2 := 0;
  PanI3 := 0;
  PanI4 := 0;
  PanI5 := 0;
  PanI6 := 0;
  PanO0 := 0;
  PanO1 := 0;
  PanO2 := 0;
  PanO3 := 0;
  PanO4 := 0;
  PanO5 := 0;
  PanO6 := 0;
  PanAnalog := 0;
//**************************pH**************************************************
  if frmRegulering.radOVPHOn.Checked = true then
    begin
      case frmRegulering.sedPHchannel.Value of
        0 : PanI0 := PanI0 +1;
        1 : PanI1 := PanI1 +1;
        2 : PanI2 := PanI2 +1;
        3 : PanI3 := PanI3 +1;
        4 : PanI4 := PanI4 +1;
        5 : PanI5 := PanI5 +1;
        6 : PanI6 := PanI6 +1;
      end;
    end;
  if (frmRegulering.radPHon.Checked = true) and (frmRegulering.radOVPHOn.Checked = true) then
    begin
      case frmRegulering.sedPHrel.Value of
        0 : PanO0 := PanO0 +1;
        1 : PanO1 := PanO1 +1;
        2 : PanO2 := PanO2 +1;
        3 : PanO3 := PanO3 +1;
        4 : PanO4 := PanO4 +1;
        5 : PanO5 := PanO5 +1;
        6 : PanO6 := PanO6 +1;
      end;
    end;
  if (frmRegulering.radPHsyreON.Checked = true) and (frmRegulering.radOVPHOn.Checked = true) then
    begin
      case frmRegulering.sedPHsyreRel.Value of
        0 : PanO0 := PanO0 +1;
        1 : PanO1 := PanO1 +1;
        2 : PanO2 := PanO2 +1;
        3 : PanO3 := PanO3 +1;
        4 : PanO4 := PanO4 +1;
        5 : PanO5 := PanO5 +1;
        6 : PanO6 := PanO6 +1;
      end;
    end;
//*****************************Temperature**************************************
  if frmRegulering.radOVTempon.Checked = true then
    begin
      case frmRegulering.sedTEMPchannel.Value of
        0 : PanI0 := PanI0 +1;
        1 : PanI1 := PanI1 +1;
        2 : PanI2 := PanI2 +1;
        3 : PanI3 := PanI3 +1;
        4 : PanI4 := PanI4 +1;
        5 : PanI5 := PanI5 +1;
        6 : PanI6 := PanI6 +1;
      end
    end;
  if (frmRegulering.radTempOn.Checked = true) and (frmRegulering.radOVTempon.Checked = true) then
    begin
      case frmRegulering.sedTempRel.Value of
        0 : PanO0 := PanO0 +1;
        1 : PanO1 := PanO1 +1;
        2 : PanO2 := PanO2 +1;
        3 : PanO3 := PanO3 +1;
        4 : PanO4 := PanO4 +1;
        5 : PanO5 := PanO5 +1;
        6 : PanO6 := PanO6 +1;
      end;
    end;
//***************************Oxygen*********************************************
  if frmRegulering.radOVIltOn.Checked = true then
    begin
      case frmRegulering.sedILTchannel.Value of
        0 : PanI0 := PanI0 +1;
        1 : PanI1 := PanI1 +1;
        2 : PanI2 := PanI2 +1;
        3 : PanI3 := PanI3 +1;
        4 : PanI4 := PanI4 +1;
        5 : PanI5 := PanI5 +1;
        6 : PanI6 := PanI6 +1;
      end
    end;
  if (frmRegulering.radILTon.Checked = true) and (frmRegulering.radOVIltOn.Checked = true) then
    begin
    PanAnalog := PanAnalog +1;
    end;
//***********************Feed***************************************************
  if frmRegulering.radMetOn.Checked = true then
    begin
      case frmRegulering.sedMetRel.Value of
        0 : PanO0 := PanO0 +1;
        1 : PanO1 := PanO1 +1;
        2 : PanO2 := PanO2 +1;
        3 : PanO3 := PanO3 +1;
        4 : PanO4 := PanO4 +1;
        5 : PanO5 := PanO5 +1;
        6 : PanO6 := PanO6 +1;
      end;
    end;
//**********************Light***************************************************
  if frmRegulering.radLight_settings_regOn.Checked = true then
    begin
    PanAnalog := PanAnalog +1;
    end;
//*********************Custom 1*************************************************
  if frmRegulering.rbAlt1Settings_MonOn.Checked = true then
    begin
      case frmRegulering.sedtAlt1Settings_Input_ch.Value of
        0 : PanI0 := PanI0 +1;
        1 : PanI1 := PanI1 +1;
        2 : PanI2 := PanI2 +1;
        3 : PanI3 := PanI3 +1;
        4 : PanI4 := PanI4 +1;
        5 : PanI5 := PanI5 +1;
        6 : PanI6 := PanI6 +1;
      end;
    end;
  if (frmRegulering.speOpt1_TypeReg_PID.Down = false) and (frmRegulering.rbAlt1Settings_RegOn.Checked = true) and (frmRegulering.rbAlt1Settings_MonOn.Checked = true) then
    begin
      case frmRegulering.sedtAlt1Settings_Output_ch.Value of
        0 : PanO0 := PanO0 +1;
        1 : PanO1 := PanO1 +1;
        2 : PanO2 := PanO2 +1;
        3 : PanO3 := PanO3 +1;
        4 : PanO4 := PanO4 +1;
        5 : PanO5 := PanO5 +1;
        6 : PanO6 := PanO6 +1;
      end;
    end;
  if (frmRegulering.rbAlt1Settings_RegOn.Checked = true) and (frmRegulering.speOpt1_TypeReg_PID.Down = true) and (frmRegulering.rbAlt1Settings_MonOn.Checked = true) then
        PanAnalog := PanAnalog +1;
  if (frmRegulering.rbAlt1Settings_RegOn.Checked = true) and (frmRegulering.speOpt1_TypeReg_Feed.Down = true) and (frmRegulering.rbAlt1Settings_MonOn.Checked = true) then
      PanAnalog := PanAnalog +1;
//*********************Custum 2*************************************************
  if frmRegulering.radAlt2Settings_MonOn.Checked = true then
    begin
      case frmRegulering.sedAlt2Settings_Input_ch.Value of
        0 : PanI0 := PanI0 +1;
        1 : PanI1 := PanI1 +1;
        2 : PanI2 := PanI2 +1;
        3 : PanI3 := PanI3 +1;
        4 : PanI4 := PanI4 +1;
        5 : PanI5 := PanI5 +1;
        6 : PanI6 := PanI6 +1;
      end;
    end;
  if (frmRegulering.speOpt2_TypeReg_PID.Down = false) and (frmRegulering.radAlt2Settings_RegOn.Checked = true) and (frmRegulering.radAlt2Settings_MonOn.Checked = true) then
    begin
      case frmRegulering.sedAlt2Settings_Output_ch.Value of
        0 : PanO0 := PanO0 +1;
        1 : PanO1 := PanO1 +1;
        2 : PanO2 := PanO2 +1;
        3 : PanO3 := PanO3 +1;
        4 : PanO4 := PanO4 +1;
        5 : PanO5 := PanO5 +1;
        6 : PanO6 := PanO6 +1;
      end;
    end;
    if (frmRegulering.radAlt2Settings_RegOn.Checked = true) and (frmRegulering.speOpt2_typereg_PID.Down = true) and (frmRegulering.radAlt2Settings_MonOn.Checked = true) then
    begin
      PanAnalog := PanAnalog +1;
    end;
  if (frmRegulering.radAlt2Settings_RegOn.Checked = true) and (frmRegulering.speOpt2_typereg_feedback.Down = true) and (frmRegulering.radAlt2Settings_MonOn.Checked = true) then
    begin
      PanAnalog := PanAnalog +1;
    end;
//*********************Update Panels********************************************
//Check Analog
  if panAnalog = 0 then
    frmRegulering.panAnalog.Color := clBtnFace
  else
    if panAnalog = 1 then
      frmRegulering.panAnalog.Color := clGreen
    else
      frmRegulering.panAnalog.Color := clRed;
//Check In
  if panI0 = 0 then
    frmRegulering.panI0.Color := clBtnFace
  else
    if panI0 = 1 then
      frmRegulering.panI0.Color := clGreen
    else
      frmRegulering.panI0.Color := clRed;
  if panI1 = 0 then
    frmRegulering.panI1.Color := clBtnFace
  else
    if panI1 = 1 then
      frmRegulering.panI1.Color := clGreen
    else
      frmRegulering.panI1.Color := clRed;
  if panI2 = 0 then
    frmRegulering.panI2.Color := clBtnFace
  else
    if panI2 = 1 then
      frmRegulering.panI2.Color := clGreen
    else
      frmRegulering.panI2.Color := clRed;
  if panI3 = 0 then
    frmRegulering.panI3.Color := clBtnFace
  else
    if panI3 = 1 then
      frmRegulering.panI3.Color := clGreen
    else
      frmRegulering.panI3.Color := clRed;
  if panI4 = 0 then
    frmRegulering.panI4.Color := clBtnFace
  else
    if panI4 = 1 then
      frmRegulering.panI4.Color := clGreen
    else
      frmRegulering.panI4.Color := clRed;
  if panI5 = 0 then
    frmRegulering.panI5.Color := clBtnFace
  else
    if panI5 = 1 then
      frmRegulering.panI5.Color := clGreen
    else
      frmRegulering.panI5.Color := clRed;
  if panI6 = 0 then
    frmRegulering.panI6.Color := clBtnFace
  else
    if panI6 = 1 then
      frmRegulering.panI6.Color := clGreen
    else
      frmRegulering.panI6.Color := clRed;
//Check Out
  if panO0 = 0 then
    frmRegulering.panO0.Color := clBtnFace
  else
    if panO0 = 1 then
      frmRegulering.panO0.Color := clGreen
    else
      frmRegulering.panO0.Color := clRed;
  if panO1 = 0 then
    frmRegulering.panO1.Color := clBtnFace
  else
    if panO1 = 1 then
      frmRegulering.panO1.Color := clGreen
    else
      frmRegulering.panO1.Color := clRed;
  if panO2 = 0 then
    frmRegulering.panO2.Color := clBtnFace
  else
    if panO2 = 1 then
      frmRegulering.panO2.Color := clGreen
    else
      frmRegulering.panO2.Color := clRed;
  if panO3 = 0 then
    frmRegulering.panO3.Color := clBtnFace
  else
    if panO3 = 1 then
      frmRegulering.panO3.Color := clGreen
    else
      frmRegulering.panO3.Color := clRed;
  if panO4 = 0 then
    frmRegulering.panO4.Color := clBtnFace
  else
    if panO4 = 1 then
      frmRegulering.panO4.Color := clGreen
    else
      frmRegulering.panO4.Color := clRed;
  if panO5 = 0 then
    frmRegulering.panO5.Color := clBtnFace
  else
    if panO5 = 1 then
      frmRegulering.panO5.Color := clGreen
    else
      frmRegulering.panO5.Color := clRed;
  if panO6 = 0 then
    frmRegulering.panO6.Color := clBtnFace
  else
    if panO6 = 1 then
      frmRegulering.panO6.Color := clGreen
    else
      frmRegulering.panO6.Color := clRed;
//*****************Update Panel Text********************************************
frmRegulering.panI0.Caption := '0';
frmRegulering.panI1.Caption := '1';
frmRegulering.panI2.Caption := '2';
frmRegulering.panI3.Caption := '3';
frmRegulering.panI4.Caption := '4';
frmRegulering.panI5.Caption := '5';
frmRegulering.panI6.Caption := '6';
frmRegulering.panO0.Caption := '0';
frmRegulering.panO1.Caption := '1';
frmRegulering.panO2.Caption := '2';
frmRegulering.panO3.Caption := '3';
frmRegulering.panO4.Caption := '4';
frmRegulering.panO5.Caption := '5';
frmRegulering.panO6.Caption := '6';
frmRegulering.panAnalog.Caption := 'Analog';
if frmRegulering.radOVPHOn.Checked = true then
    begin
      case frmRegulering.sedPHchannel.Value of
        0 : frmRegulering.panI0.Caption := 'pH';
        1 : frmRegulering.panI1.Caption := 'pH';
        2 : frmRegulering.panI2.Caption := 'pH';
        3 : frmRegulering.panI3.Caption := 'pH';
        4 : frmRegulering.panI4.Caption := 'pH';
        5 : frmRegulering.panI5.Caption := 'pH';
        6 : frmRegulering.panI6.Caption := 'pH';
      end;
    end;

  if (frmRegulering.radPHon.Checked = true) and (frmRegulering.radOVPHOn.Checked = true) then
    begin
      case frmRegulering.sedPHrel.Value of
        0 : frmRegulering.panO0.Caption := 'Base';
        1 : frmRegulering.panO1.Caption := 'Base';
        2 : frmRegulering.panO2.Caption := 'Base';
        3 : frmRegulering.panO3.Caption := 'Base';
        4 : frmRegulering.panO4.Caption := 'Base';
        5 : frmRegulering.panO5.Caption := 'Base';
        6 : frmRegulering.panO6.Caption := 'Base';
      end;
    end;
  if (frmRegulering.radPHsyreON.Checked = true) and (frmRegulering.radOVPHOn.Checked = true) then
    begin
      case frmRegulering.sedPHsyreRel.Value of
        0 : frmRegulering.panO0.Caption := 'Acid';
        1 : frmRegulering.panO1.Caption := 'Acid';
        2 : frmRegulering.panO2.Caption := 'Acid';
        3 : frmRegulering.panO3.Caption := 'Acid';
        4 : frmRegulering.panO4.Caption := 'Acid';
        5 : frmRegulering.panO5.Caption := 'Acid';
        6 : frmRegulering.panO6.Caption := 'Acid';
      end;
    end;
//*****************************Temperature**************************************
  if frmRegulering.radOVTempon.Checked = true then
    begin
      case frmRegulering.sedTEMPchannel.Value of
        0 : frmRegulering.panI0.Caption := 'Temp';
        1 : frmRegulering.panI1.Caption := 'Temp';
        2 : frmRegulering.panI2.Caption := 'Temp';
        3 : frmRegulering.panI3.Caption := 'Temp';
        4 : frmRegulering.panI4.Caption := 'Temp';
        5 : frmRegulering.panI5.Caption := 'Temp';
        6 : frmRegulering.panI6.Caption := 'Temp';
      end
    end;
  if (frmRegulering.radTempOn.Checked = true) and (frmRegulering.radOVTempon.Checked = true) then
    begin
      case frmRegulering.sedTempRel.Value of
        0 : frmRegulering.panO0.Caption := 'Temp';
        1 : frmRegulering.panO1.Caption := 'Temp';
        2 : frmRegulering.panO2.Caption := 'Temp';
        3 : frmRegulering.panO3.Caption := 'Temp';
        4 : frmRegulering.panO4.Caption := 'Temp';
        5 : frmRegulering.panO5.Caption := 'Temp';
        6 : frmRegulering.panO6.Caption := 'Temp';
      end;
    end;
//***************************Oxygen*********************************************
  if frmRegulering.radOVIltOn.Checked = true then
    begin
      case frmRegulering.sedILTchannel.Value of
        0 : frmRegulering.panI0.Caption := 'O2';
        1 : frmRegulering.panI1.Caption := 'O2';
        2 : frmRegulering.panI2.Caption := 'O2';
        3 : frmRegulering.panI3.Caption := 'O2';
        4 : frmRegulering.panI4.Caption := 'O2';
        5 : frmRegulering.panI5.Caption := 'O2';
        6 : frmRegulering.panI6.Caption := 'O2';
      end
    end;
  if (frmRegulering.radILTon.Checked = true) and (frmRegulering.radOVIltOn.Checked = true) then
    begin
      frmRegulering.panAnalog.Caption := 'O2';
    end;
//***********************Feed***************************************************
  if frmRegulering.radMetOn.Checked = true then
    begin
      case frmRegulering.sedMetRel.Value of
        0 : frmRegulering.panO0.Caption := 'Feed';
        1 : frmRegulering.panO1.Caption := 'Feed';
        2 : frmRegulering.panO2.Caption := 'Feed';
        3 : frmRegulering.panO3.Caption := 'Feed';
        4 : frmRegulering.panO4.Caption := 'Feed';
        5 : frmRegulering.panO5.Caption := 'Feed';
        6 : frmRegulering.panO6.Caption := 'Feed';
      end;
    end;
//**********************Light***************************************************
  if frmRegulering.radLight_settings_regOn.Checked = true then
    begin
      frmRegulering.panAnalog.Caption := 'Light';
    end;
//*********************Custom 1*************************************************
  if frmRegulering.rbAlt1Settings_MonOn.Checked = true then
    begin
      case frmRegulering.sedtAlt1Settings_Input_ch.Value of
        0 : frmRegulering.panI0.Caption := 'Cus1';
        1 : frmRegulering.panI1.Caption := 'Cus1';
        2 : frmRegulering.panI2.Caption := 'Cus1';
        3 : frmRegulering.panI3.Caption := 'Cus1';
        4 : frmRegulering.panI4.Caption := 'Cus1';
        5 : frmRegulering.panI5.Caption := 'Cus1';
        6 : frmRegulering.panI6.Caption := 'Cus1';
      end
    end;
  if (frmRegulering.speOpt1_TypeReg_PID.Down = false) and (frmRegulering.rbAlt1Settings_RegOn.Checked = true) and (frmRegulering.rbAlt1Settings_MonOn.Checked = true) then
    begin
      case frmRegulering.sedtAlt1Settings_Output_ch.Value of
        0 : frmRegulering.panO0.Caption := 'Cus1';
        1 : frmRegulering.panO1.Caption := 'Cus1';
        2 : frmRegulering.panO2.Caption := 'Cus1';
        3 : frmRegulering.panO3.Caption := 'Cus1';
        4 : frmRegulering.panO4.Caption := 'Cus1';
        5 : frmRegulering.panO5.Caption := 'Cus1';
        6 : frmRegulering.panO6.Caption := 'Cus1';
      end;
    end;
  if (frmRegulering.rbAlt1Settings_RegOn.Checked = true) and (frmRegulering.speOpt1_TypeReg_Feed.Down = true) and (frmRegulering.rbAlt1Settings_MonOn.Checked = true) then
    begin
      frmRegulering.panAnalog.Caption := 'Cus1';
    end;
  if (frmRegulering.rbAlt1Settings_RegOn.Checked = true) and (frmRegulering.speOpt1_TypeReg_PID.Down = true) and (frmRegulering.rbAlt1Settings_MonOn.Checked = true) then
    begin
      frmRegulering.panAnalog.Caption := 'Cus1';
    end;
//*********************Custum 2*************************************************
  if frmRegulering.radAlt2Settings_MonOn.Checked = true then
    begin
      case frmRegulering.sedAlt2Settings_Input_ch.Value of
        0 : frmRegulering.panI0.Caption := 'Cus2';
        1 : frmRegulering.panI1.Caption := 'Cus2';
        2 : frmRegulering.panI2.Caption := 'Cus2';
        3 : frmRegulering.panI3.Caption := 'Cus2';
        4 : frmRegulering.panI4.Caption := 'Cus2';
        5 : frmRegulering.panI5.Caption := 'Cus2';
        6 : frmRegulering.panI6.Caption := 'Cus2';
      end
    end;
  if (frmRegulering.speOpt2_TypeReg_PID.Down = false) and (frmRegulering.radAlt2Settings_RegOn.Checked = true) and (frmRegulering.radAlt2Settings_MonOn.Checked = true) then
    begin
      case frmRegulering.sedAlt2Settings_Output_ch.Value of
        0 : frmRegulering.panO0.Caption := 'Cus2';
        1 : frmRegulering.panO1.Caption := 'Cus2';
        2 : frmRegulering.panO2.Caption := 'Cus2';
        3 : frmRegulering.panO3.Caption := 'Cus2';
        4 : frmRegulering.panO4.Caption := 'Cus2';
        5 : frmRegulering.panO5.Caption := 'Cus2';
        6 : frmRegulering.panO6.Caption := 'Cus2';
      end;
    end;
  if (frmRegulering.radAlt2Settings_RegOn.Checked = true) and (frmRegulering.speOpt2_typereg_feedback.Down = true) and (frmRegulering.radAlt2Settings_MonOn.Checked = true) then
    begin
      frmRegulering.panAnalog.Caption := 'Cus2';
    end;
  if (frmRegulering.radAlt2Settings_RegOn.Checked = true) and (frmRegulering.speOpt2_typereg_PID.Down = true) and (frmRegulering.radAlt2Settings_MonOn.Checked = true) then
    begin
      frmRegulering.panAnalog.Caption := 'Cus2';
    end;

end;


procedure TfrmRegulering.btnAlt1Click(Sender: TObject);
begin
frmRegulering.gpbPHindstillinger.Visible := false;
frmRegulering.gpbRegpH.Visible := false;
frmRegulering.gpbRegTemp.Visible := false;
frmRegulering.gpbTempSettings.Visible := false;
frmRegulering.gpbFeedSettings.Visible := false;
frmRegulering.gpbRegFeed.Visible := false;
frmRegulering.gpbOxySettings.Visible := false;
frmRegulering.gpbRegOxy.Visible := false;
frmRegulering.gpbLigSettings.Visible := false;
frmRegulering.gpbRegLig.Visible := false;
frmRegulering.gpbRegAlt2.Visible := false;
frmRegulering.gpbAlt2Settings.Visible := false;
frmRegulering.gpbOpt1.Visible := true;
frmRegulering.gpbAlt1Settings.Visible := true;
//Hides calibration eq. panels
frmRegulering.grbpH_Calibration_input.Visible := false;        // ph
frmRegulering.grbpH_Calibration_OutputBase.Visible := false;   // ph
frmRegulering.grbpH_Calibration_OutputAcid.Visible := false;   // ph
frmRegulering.grbTemp_Calibration_input.Visible := false;      // Temp
frmRegulering.grbOxygen_Calibration_input.Visible := false;    // Oxygen
frmRegulering.grbOxygen_Calibration_output.Visible := false;   // Oxygen
frmRegulering.grbFeed_Calibration_output.visible := false;     // Feed
frmRegulering.grbLight_Calibration_output.Visible := false;    // Light
frmRegulering.grbAlt1_Calibration_output1.Visible := false;    // Custom 1
frmRegulering.grbAlt1_Calibration_input.Visible := false;      // Custom 1
frmRegulering.grbAlt2_Calibration_output1.Visible := false;    // Custom 2
frmRegulering.grbAlt2_Calibration_input.Visible := false;      // Custom 2
end;

procedure TfrmRegulering.btnAlt2Click(Sender: TObject);
begin
frmRegulering.gpbPHindstillinger.Visible := false;
frmRegulering.gpbRegpH.Visible := false;
frmRegulering.gpbRegTemp.Visible := false;
frmRegulering.gpbTempSettings.Visible := false;
frmRegulering.gpbFeedSettings.Visible := false;
frmRegulering.gpbRegFeed.Visible := false;
frmRegulering.gpbOxySettings.Visible := false;
frmRegulering.gpbRegOxy.Visible := false;
frmRegulering.gpbLigSettings.Visible := false;
frmRegulering.gpbRegLig.Visible := false;
frmRegulering.gpbAlt2Settings.Visible := true;
frmRegulering.gpbRegAlt2.Visible := true;
frmRegulering.gpbAlt1Settings.Visible := false;
frmRegulering.gpbOpt1.Visible := false;
//Hides calibration eq. panels
frmRegulering.grbpH_Calibration_input.Visible := false;        // ph
frmRegulering.grbpH_Calibration_OutputBase.Visible := false;   // ph
frmRegulering.grbpH_Calibration_OutputAcid.Visible := false;   // ph
frmRegulering.grbTemp_Calibration_input.Visible := false;      // Temp
frmRegulering.grbOxygen_Calibration_input.Visible := false;    // Oxygen
frmRegulering.grbOxygen_Calibration_output.Visible := false;   // Oxygen
frmRegulering.grbFeed_Calibration_output.visible := false;     // Feed
frmRegulering.grbLight_Calibration_output.Visible := false;    // Light
frmRegulering.grbAlt1_Calibration_output1.Visible := false;    // Custom 1
frmRegulering.grbAlt1_Calibration_input.Visible := false;      // Custom 1
frmRegulering.grbAlt2_Calibration_output1.Visible := false;    // Custom 2
frmRegulering.grbAlt2_Calibration_input.Visible := false;      // Custom 2

end;

procedure TfrmRegulering.btnFeedClick(Sender: TObject);
begin
frmRegulering.gpbPHindstillinger.Visible := false;
frmRegulering.gpbRegpH.Visible := false;
frmRegulering.gpbRegTemp.Visible := false;
frmRegulering.gpbTempSettings.Visible := false;
frmRegulering.gpbFeedSettings.Visible := true;
frmRegulering.gpbRegFeed.Visible := true;
frmRegulering.gpbOxySettings.Visible := false;
frmRegulering.gpbRegOxy.Visible := false;
frmRegulering.gpbLigSettings.Visible := false;
frmRegulering.gpbRegLig.Visible := false;
frmRegulering.gpbAlt1Settings.Visible := false;
frmRegulering.gpbAlt2Settings.Visible := false;
frmRegulering.gpbOpt1.Visible := false;
frmRegulering.gpbRegAlt2.Visible := false;
//Hides calibration eq. panels
frmRegulering.grbpH_Calibration_input.Visible := false;        // ph
frmRegulering.grbpH_Calibration_OutputBase.Visible := false;   // ph
frmRegulering.grbpH_Calibration_OutputAcid.Visible := false;   // ph
frmRegulering.grbTemp_Calibration_input.Visible := false;      // Temp
frmRegulering.grbOxygen_Calibration_input.Visible := false;    // Oxygen
frmRegulering.grbOxygen_Calibration_output.Visible := false;   // Oxygen
frmRegulering.grbFeed_Calibration_output.visible := false;     // Feed
frmRegulering.grbLight_Calibration_output.Visible := false;    // Light
frmRegulering.grbAlt1_Calibration_output1.Visible := false;    // Custom 1
frmRegulering.grbAlt1_Calibration_input.Visible := false;      // Custom 1
frmRegulering.grbAlt2_Calibration_output1.Visible := false;    // Custom 2
frmRegulering.grbAlt2_Calibration_input.Visible := false;      // Custom 2
end;

procedure TfrmRegulering.btnIltAdvClick(Sender: TObject);
begin
  frmADVPIDilt.Show;
end;

procedure TfrmRegulering.btnLightClick(Sender: TObject);
begin
frmRegulering.gpbPHindstillinger.Visible := false;
frmRegulering.gpbRegpH.Visible := false;
frmRegulering.gpbRegTemp.Visible := false;
frmRegulering.gpbTempSettings.Visible := false;
frmRegulering.gpbFeedSettings.Visible := false;
frmRegulering.gpbRegFeed.Visible := false;
frmRegulering.gpbOxySettings.Visible := false;
frmRegulering.gpbRegOxy.Visible := false;
frmRegulering.gpbLigSettings.Visible := true;
frmRegulering.gpbRegLig.Visible := true;
frmRegulering.gpbAlt1Settings.Visible := false;
frmRegulering.gpbAlt2Settings.Visible := false;
frmRegulering.gpbOpt1.Visible := false;
frmRegulering.gpbRegAlt2.Visible := false;
//Hides calibration eq. panels
frmRegulering.grbpH_Calibration_input.Visible := false;        // ph
frmRegulering.grbpH_Calibration_OutputBase.Visible := false;   // ph
frmRegulering.grbpH_Calibration_OutputAcid.Visible := false;   // ph
frmRegulering.grbTemp_Calibration_input.Visible := false;      // Temp
frmRegulering.grbOxygen_Calibration_input.Visible := false;    // Oxygen
frmRegulering.grbOxygen_Calibration_output.Visible := false;   // Oxygen
frmRegulering.grbFeed_Calibration_output.visible := false;     // Feed
frmRegulering.grbLight_Calibration_output.Visible := false;    // Light
frmRegulering.grbAlt1_Calibration_output1.Visible := false;    // Custom 1
frmRegulering.grbAlt1_Calibration_input.Visible := false;      // Custom 1
frmRegulering.grbAlt2_Calibration_output1.Visible := false;    // Custom 2
frmRegulering.grbAlt2_Calibration_input.Visible := false;      // Custom 2
end;



procedure TfrmRegulering.btnOpt1_PID_AdvSetClick(Sender: TObject);
begin
   frmAdvPID_Opt1.show;
end;

procedure TfrmRegulering.btnOpt2_PID_parameters_advClick(Sender: TObject);
begin
   frmAdvPID_Opt2.show;
end;

procedure TfrmRegulering.btnOxygenClick(Sender: TObject);
begin
frmRegulering.gpbPHindstillinger.Visible := false;
frmRegulering.gpbRegpH.Visible := false;
frmRegulering.gpbRegTemp.Visible := false;
frmRegulering.gpbTempSettings.Visible := false;
frmRegulering.gpbFeedSettings.Visible := false;
frmRegulering.gpbRegFeed.Visible := false;
frmRegulering.gpbOxySettings.Visible := true;
frmRegulering.gpbRegOxy.Visible := true;
frmRegulering.gpbLigSettings.Visible := false;
frmRegulering.gpbRegLig.Visible := false;
frmRegulering.gpbAlt1Settings.Visible := false;
frmRegulering.gpbAlt2Settings.Visible := false;
frmRegulering.gpbOpt1.Visible := false;
frmRegulering.gpbRegAlt2.Visible := false;
//Hides calibration eq. panels
frmRegulering.grbpH_Calibration_input.Visible := false;        // ph
frmRegulering.grbpH_Calibration_OutputBase.Visible := false;   // ph
frmRegulering.grbpH_Calibration_OutputAcid.Visible := false;   // ph
frmRegulering.grbTemp_Calibration_input.Visible := false;      // Temp
frmRegulering.grbOxygen_Calibration_input.Visible := false;    // Oxygen
frmRegulering.grbOxygen_Calibration_output.Visible := false;   // Oxygen
frmRegulering.grbFeed_Calibration_output.visible := false;     // Feed
frmRegulering.grbLight_Calibration_output.Visible := false;    // Light
frmRegulering.grbAlt1_Calibration_output1.Visible := false;    // Custom 1
frmRegulering.grbAlt1_Calibration_input.Visible := false;      // Custom 1
frmRegulering.grbAlt2_Calibration_output1.Visible := false;    // Custom 2
frmRegulering.grbAlt2_Calibration_input.Visible := false;      // Custom 2
end;

procedure TfrmRegulering.btnpHClick(Sender: TObject);
begin
frmRegulering.gpbPHindstillinger.Visible := true;
frmRegulering.gpbRegpH.Visible := true;
frmRegulering.gpbRegTemp.Visible := false;
frmRegulering.gpbTempSettings.Visible := false;
frmRegulering.gpbFeedSettings.Visible := false;
frmRegulering.gpbRegFeed.Visible := false;
frmRegulering.gpbOxySettings.Visible := false;
frmRegulering.gpbRegOxy.Visible := false;
frmRegulering.gpbLigSettings.Visible := false;
frmRegulering.gpbRegLig.Visible := false;
frmRegulering.gpbAlt1Settings.Visible := false;
frmRegulering.gpbAlt2Settings.Visible := false;
frmRegulering.gpbOpt1.Visible := false;
frmRegulering.gpbRegAlt2.Visible := false;
//Hides calibration eq. panels
frmRegulering.grbpH_Calibration_input.Visible := false;        // ph
frmRegulering.grbpH_Calibration_OutputBase.Visible := false;   // ph
frmRegulering.grbpH_Calibration_OutputAcid.Visible := false;   // ph
frmRegulering.grbTemp_Calibration_input.Visible := false;      // Temp
frmRegulering.grbOxygen_Calibration_input.Visible := false;    // Oxygen
frmRegulering.grbOxygen_Calibration_output.Visible := false;   // Oxygen
frmRegulering.grbFeed_Calibration_output.visible := false;     // Feed
frmRegulering.grbLight_Calibration_output.Visible := false;    // Light
frmRegulering.grbAlt1_Calibration_output1.Visible := false;    // Custom 1
frmRegulering.grbAlt1_Calibration_input.Visible := false;      // Custom 1
frmRegulering.grbAlt2_Calibration_output1.Visible := false;    // Custom 2
frmRegulering.grbAlt2_Calibration_input.Visible := false;      // Custom 2
end;

procedure TfrmRegulering.btnTempClick(Sender: TObject);
begin
frmRegulering.gpbPHindstillinger.Visible := false;
frmRegulering.gpbRegpH.Visible := false;
frmRegulering.gpbRegTemp.Visible := true;
frmRegulering.gpbTempSettings.Visible := true;
frmRegulering.gpbFeedSettings.Visible := false;
frmRegulering.gpbRegFeed.Visible := false;
frmRegulering.gpbOxySettings.Visible := false;
frmRegulering.gpbRegOxy.Visible := false;
frmRegulering.gpbLigSettings.Visible := false;
frmRegulering.gpbRegLig.Visible := false;
frmRegulering.gpbAlt1Settings.Visible := false;
frmRegulering.gpbAlt2Settings.Visible := false;
frmRegulering.gpbOpt1.Visible := false;
frmRegulering.gpbRegAlt2.Visible := false;
//Hides calibration eq. panels
frmRegulering.grbpH_Calibration_input.Visible := false;        // ph
frmRegulering.grbpH_Calibration_OutputBase.Visible := false;   // ph
frmRegulering.grbpH_Calibration_OutputAcid.Visible := false;   // ph
frmRegulering.grbTemp_Calibration_input.Visible := false;      // Temp
frmRegulering.grbOxygen_Calibration_input.Visible := false;    // Oxygen
frmRegulering.grbOxygen_Calibration_output.Visible := false;   // Oxygen
frmRegulering.grbFeed_Calibration_output.visible := false;     // Feed
frmRegulering.grbLight_Calibration_output.Visible := false;    // Light
frmRegulering.grbAlt1_Calibration_output1.Visible := false;    // Custom 1
frmRegulering.grbAlt1_Calibration_input.Visible := false;      // Custom 1
frmRegulering.grbAlt2_Calibration_output1.Visible := false;    // Custom 2
frmRegulering.grbAlt2_Calibration_input.Visible := false;      // Custom 2
end;

procedure TfrmRegulering.edtFeedOODelayKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtFeedOODelay.Text;
CheckInput;
end;

procedure TfrmRegulering.edtFlowHastighedKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtFlowHastighed.Text;
CheckInput;
end;

procedure TfrmRegulering.edtIltKpKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtIltKp.Text;
CheckInput;
end;

procedure TfrmRegulering.edtIltNormalOutputKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtIltNormalOutput.Text;
CheckInput;
end;

procedure TfrmRegulering.edtILTsetpointMinKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtILTsetpointMin.Text;
CheckInput;
end;

procedure TfrmRegulering.edtILTTdKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtILTTd.Text;
CheckInput;
end;

procedure TfrmRegulering.edtIltTidsforsinkelseKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtIltTidsforsinkelse.Text;
CheckInput;
end;

procedure TfrmRegulering.edtILTTiKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtILTTi.Text;
CheckInput;
end;

procedure TfrmRegulering.edtLight_parameters_CriticalFeedKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtLight_parameters_CriticalFeed.Text;
CheckInput;
end;

procedure TfrmRegulering.edtLight_parameters_IncrementSizeKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtLight_parameters_IncrementSize.Text;
CheckInput;
end;

procedure TfrmRegulering.edtLight_parameters_normalKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtLight_parameters_normal.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_DoPa_DoseSizeKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_DoPa_DoseSize.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_DoPa_RegPauseKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_DoPa_RegPause.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_DoPa_setpointsKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_DoPa_setpoints.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_Feedback_parameters_CriticalFeedKeyUp(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_Feedback_parameters_CriticalFeed.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_Feedback_parameters_DoseSizeKeyUp(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_Feedback_parameters_DoseSize.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_Feedback_parameters_DoseTimedelayKeyUp(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_Feedback_parameters_DoseTimedelay.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_Feedback_parameters_IncrementsSizeKeyUp(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_Feedback_parameters_IncrementsSize.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_Feedback_parameters_normalKeyUp(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_Feedback_parameters_normal.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_Feedback_setpointKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_Feedback_setpoint.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_OnOf_setpointKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_OnOf_setpoint.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_onof_timedelayKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_onof_timedelay.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_PID_kpKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_PID_kp.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_PID_maxvalueKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_PID_maxvalue.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_PID_minvalueKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_PID_minvalue.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_PID_normalKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_PID_normal.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_PID_setpointsKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_PID_setpoints.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_PID_tdKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_PID_td.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_PID_tiKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_PID_ti.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt1_PID_TimeDelayKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt1_PID_TimeDelay.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_dopa_parameters_dosesizeKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_dopa_parameters_dosesize.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_dopa_parameters_pauseKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_dopa_parameters_pause.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_dopa_setpointsKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_dopa_setpoints.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_Feedback_parameters_CriticalFeedKeyUp(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_Feedback_parameters_CriticalFeed.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_Feedback_parameters_DoseSizeKeyUp(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_Feedback_parameters_DoseSize.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_Feedback_parameters_DoseTimedelayKeyUp(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_Feedback_parameters_DoseTimedelay.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_Feedback_parameters_IncrementsSizeKeyUp(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_Feedback_parameters_IncrementsSize.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_Feedback_parameters_normalKeyUp(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_Feedback_parameters_normal.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_Feedback_setpointKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_Feedback_setpoint.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_onof_parameter_timedelayKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_onof_parameter_timedelay.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_onof_setpointsKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_onof_setpoints.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_PID_parameters_kpKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_PID_parameters_kp.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_PID_parameters_maxvalueKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_PID_parameters_maxvalue.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_PID_parameters_minvalueKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_PID_parameters_minvalue.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_PID_parameters_normalKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_PID_parameters_normal.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_PID_parameters_tdKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_PID_parameters_td.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_PID_parameters_tiKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_PID_parameters_ti.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_PID_parameters_timedelayKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_PID_parameters_timedelay.Text;
CheckInput;
end;

procedure TfrmRegulering.edtOpt2_PID_setpointKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtOpt2_PID_setpoint.Text;
CheckInput;
end;

procedure TfrmRegulering.edtPHMaxSetpointKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtPHMaxSetpoint.Text;
CheckInput;
end;

procedure TfrmRegulering.edtPHsetpointKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtPHsetpoint.Text;
CheckInput;
end;

procedure TfrmRegulering.edtPHsyreTimerIntervalKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtPHsyreTimerInterval.Text;
CheckInput;
end;

procedure TfrmRegulering.edtPHTimerIntervalKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtPHTimerInterval.Text;
CheckInput;
end;

procedure TfrmRegulering.edtRPMmaxKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtRPMmax.Text;
CheckInput;
end;

procedure TfrmRegulering.edtRPMminKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtRPMmin.Text;
CheckInput;
end;

procedure TfrmRegulering.edtTEMPsetpointKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtTEMPsetpoint.Text;
CheckInput;
end;

procedure TfrmRegulering.edtTempTidsforsinkelseKeyUp(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
TypedText := frmRegulering.edtTempTidsforsinkelse.Text;
CheckInput;
end;

procedure TfrmRegulering.edtTidsforsinkelseKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
TypedText := frmRegulering.edtTidsforsinkelse.Text;
CheckInput;
end;

procedure TfrmRegulering.FormCreate(Sender: TObject);
begin
SetWindowPos(  Handle,  HWND_TOPMOST,  0,   0,   0,   0,   SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
end;

procedure TfrmRegulering.FormShow(Sender: TObject);
begin
ActiveChannels;
if speOpt1_TypeReg_PID.Down = true then  //Shows the correct output options
  begin
    lblAlt1Settings_Output_ch.Visible := false;
    sedtAlt1Settings_Output_ch.Visible := false;
    SpeedButton32.Visible := false;
    lblAlt1Settings_Output_ch2.Visible := true;
    edtAlt1Settings_Output_ch2.Visible := true;
    sbtnAlt1Settings_Output_ch2Calibration.Visible := true;
  end
else if speOpt1_TypeReg_Feed.Down = true then
  begin
    lblAlt1Settings_Output_ch2.Visible := true;
    edtAlt1Settings_Output_ch2.Visible := true;
    sbtnAlt1Settings_Output_ch2Calibration.Visible := true;
  end;

if speOpt2_typereg_PID.Down = true then
  begin
    lblAlt2Settings_Output_ch.Visible := false;
    sedAlt2Settings_Output_ch.Visible := false;
    SpeedButton34.Visible := false;
    lblAlt2Settings_Output_ch2.Visible := true;
    edtAlt2Settings_Output_ch2.Visible := true;
    sbtnAlt2Settings_Output_ch2.Visible := true;
  end
 else if speOpt2_typereg_feedback.Down = true then
   begin
    lblAlt2Settings_Output_ch2.Visible := true;
    edtAlt2Settings_Output_ch2.Visible := true;
    sbtnAlt2Settings_Output_ch2.Visible := true;
   end;
end;

procedure TfrmRegulering.radAlt2Settings_MonOffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radAlt2Settings_MonOnClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radAlt2Settings_RegOffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radAlt2Settings_RegOnClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radILToffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radILTonClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radLight_settings_regOfClick(Sender: TObject);
begin
   ActiveChannels;
end;

procedure TfrmRegulering.radLight_settings_regOnClick(Sender: TObject);
begin
   ActiveChannels;
end;

procedure TfrmRegulering.radMetOffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radMetOnClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radOVIltOffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radOVIltOnClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radOVPHoffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radOVPHOnClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radOVTempOffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radOVTempOnClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radPHoffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radPHonClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radPHsyreOffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radPHsyreONClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radTEMPoffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.radTEMPonClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.rbAlt1Settings_MonOffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.rbAlt1Settings_MonOnClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.rbAlt1Settings_RegOffClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.rbAlt1Settings_RegOnClick(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.speOPt1_typeReg_DoPaClick(Sender: TObject);
begin
   frmRegulering.grbOpt1_DoPa_parameters.visible := true;
   frmRegulering.grbOpt1_DoPa_setpoints .visible := true;
   frmRegulering.grbOpt1_OnOf_parameters.visible := false;
   frmRegulering.grbOpt1_OnOf_setpoints.visible := false;
   frmRegulering.grbOpt1_PID_parameters.visible := false;
   frmRegulering.grbOpt1_PID_setpoint.visible := false;
   frmRegulering.grbOpt1_Feedback_setpoints.Visible := false;
   frmRegulering.grbOpt1_Feedback_parameters.Visible := false;
   frmRegulering.sbtnAlt1Settings_Output_ch2Calibration.Visible := false;
   frmRegulering.edtAlt1Settings_Output_ch2.Visible := false;
   frmRegulering.lblAlt1Settings_Output_ch2.Visible := false;
   frmRegulering.lblAlt1Settings_Output_ch.Caption := 'Output channel:';
   frmRegulering.SpeedButton32.Visible := true;
   frmRegulering.sedtAlt1Settings_Output_ch.Visible := true;
   frmRegulering.lblAlt1Settings_Output_ch.Visible := true;
   ActiveChannels;
end;

procedure TfrmRegulering.speOpt1_TypeReg_FeedClick(Sender: TObject);
begin
   frmRegulering.grbOpt1_DoPa_parameters.visible := false;
   frmRegulering.grbOpt1_DoPa_setpoints .visible := false;
   frmRegulering.grbOpt1_OnOf_parameters.visible := false;
   frmRegulering.grbOpt1_OnOf_setpoints.visible := false;
   frmRegulering.grbOpt1_PID_parameters.visible := false;
   frmRegulering.grbOpt1_PID_setpoint.visible := false;
   frmRegulering.grbOpt1_Feedback_setpoints.Visible := true;
   frmRegulering.grbOpt1_Feedback_parameters.Visible := true;
   frmRegulering.sbtnAlt1Settings_Output_ch2Calibration.Visible := true;
   frmRegulering.edtAlt1Settings_Output_ch2.Visible := true;
   frmRegulering.lblAlt1Settings_Output_ch2.Visible := true;
   frmRegulering.lblAlt1Settings_Output_ch.Caption := 'Outp. ch. (Reg I):';
   frmRegulering.SpeedButton32.Visible := true;
   frmRegulering.sedtAlt1Settings_Output_ch.Visible := true;
   frmRegulering.lblAlt1Settings_Output_ch.Visible := true;
   ActiveChannels;
end;

procedure TfrmRegulering.speOpt1_typeReg_OnOfClick(Sender: TObject);
begin
   frmRegulering.grbOpt1_DoPa_parameters.visible := false;
   frmRegulering.grbOpt1_DoPa_setpoints .visible := false;
   frmRegulering.grbOpt1_OnOf_parameters.visible := true;
   frmRegulering.grbOpt1_OnOf_setpoints.visible := true;
   frmRegulering.grbOpt1_PID_parameters.visible := false;
   frmRegulering.grbOpt1_PID_setpoint.visible := false;
   frmRegulering.grbOpt1_Feedback_setpoints.Visible := false;
   frmRegulering.grbOpt1_Feedback_parameters.Visible := false;
   frmRegulering.sbtnAlt1Settings_Output_ch2Calibration.Visible := false;
   frmRegulering.edtAlt1Settings_Output_ch2.Visible := false;
   frmRegulering.lblAlt1Settings_Output_ch2.Visible := false;
   frmRegulering.lblAlt1Settings_Output_ch.Caption := 'Output channel:';
   frmRegulering.SpeedButton32.Visible := true;
   frmRegulering.sedtAlt1Settings_Output_ch.Visible := true;
   frmRegulering.lblAlt1Settings_Output_ch.Visible := true;
   ActiveChannels;
end;

procedure TfrmRegulering.speOpt1_TypeReg_PIDClick(Sender: TObject);
begin
   frmRegulering.grbOpt1_DoPa_parameters.visible := false;
   frmRegulering.grbOpt1_DoPa_setpoints .visible := false;
   frmRegulering.grbOpt1_OnOf_parameters.visible := false;
   frmRegulering.grbOpt1_OnOf_setpoints.visible := false;
   frmRegulering.grbOpt1_PID_parameters.visible := true;
   frmRegulering.grbOpt1_PID_setpoint.visible := true;
   frmRegulering.grbOpt1_Feedback_setpoints.Visible := false;
   frmRegulering.grbOpt1_Feedback_parameters.Visible := false;
   frmRegulering.sbtnAlt1Settings_Output_ch2Calibration.Visible := true;
   frmRegulering.SpeedButton32.Visible := false;
   frmRegulering.sedtAlt1Settings_Output_ch.Visible := false;
   frmRegulering.lblAlt1Settings_Output_ch.Visible := false;
   frmRegulering.edtAlt1Settings_Output_ch2.Visible := true;
   frmRegulering.lblAlt1Settings_Output_ch2.Visible := true;
   frmRegulering.lblAlt1Settings_Output_ch.Caption := 'Output channel:';
   ActiveChannels;
end;

procedure TfrmRegulering.speOpt2_typereg_dopaClick(Sender: TObject);
begin
   frmRegulering.grbOpt2_onof_setpoints.visible := false;
   frmRegulering.grbOpt2_onof_parameter.visible := false;
   frmRegulering.grbOpt2_dopa_setpoints.visible := true;
   frmRegulering.grbOpt2_dopa_parameters.visible := true;
   frmRegulering.grbOpt2_PID_setpoint.visible := false;
   frmRegulering.grbOpt2_PID_parameters.visible := false;
   frmRegulering.grbOpt2_feedback_setpoint.visible := false;
   frmRegulering.grbOpt2_feedback_parameters.visible := false;
   frmRegulering.lblAlt2Settings_Output_ch2.Visible := false;
   frmRegulering.edtAlt2Settings_Output_ch2.Visible := false;
   frmRegulering.sbtnAlt2Settings_Output_ch2.Visible := false;
   frmRegulering.lblAlt2Settings_Output_ch.Caption := 'Output channel:';
   frmRegulering.sedAlt2Settings_Output_ch.Visible := true;
   frmRegulering.lblAlt2Settings_Output_ch.Visible := true;
   frmRegulering.SpeedButton34.Visible := true;
   ActiveChannels;
end;

procedure TfrmRegulering.speOpt2_typereg_feedbackClick(Sender: TObject);
begin
   frmRegulering.grbOpt2_onof_setpoints.visible := false;
   frmRegulering.grbOpt2_onof_parameter.visible := false;
   frmRegulering.grbOpt2_dopa_setpoints.visible := false;
   frmRegulering.grbOpt2_dopa_parameters.visible := false;
   frmRegulering.grbOpt2_PID_setpoint.visible := false;
   frmRegulering.grbOpt2_PID_parameters.visible := false;
   frmRegulering.grbOpt2_feedback_setpoint.visible := true;
   frmRegulering.grbOpt2_feedback_parameters.visible := true;
   frmRegulering.lblAlt2Settings_Output_ch2.Visible := true;
   frmRegulering.edtAlt2Settings_Output_ch2.Visible := true;
   frmRegulering.sbtnAlt2Settings_Output_ch2.Visible := true;
   frmRegulering.lblAlt2Settings_Output_ch.Caption := 'Outp. ch. (Reg I):';
   frmRegulering.sedAlt2Settings_Output_ch.Visible := true;
   frmRegulering.lblAlt2Settings_Output_ch.Visible := true;
   frmRegulering.SpeedButton34.Visible := true;
   ActiveChannels;
end;

procedure TfrmRegulering.speOpt2_typereg_onofClick(Sender: TObject);
begin
   frmRegulering.grbOpt2_onof_setpoints.visible := true;
   frmRegulering.grbOpt2_onof_parameter.visible := true;
   frmRegulering.grbOpt2_dopa_setpoints.visible := false;
   frmRegulering.grbOpt2_dopa_parameters.visible := false;
   frmRegulering.grbOpt2_PID_setpoint.visible := false;
   frmRegulering.grbOpt2_PID_parameters.visible := false;
   frmRegulering.grbOpt2_feedback_setpoint.visible := false;
   frmRegulering.grbOpt2_feedback_parameters.visible := false;
   frmRegulering.lblAlt2Settings_Output_ch2.Visible := false;
   frmRegulering.edtAlt2Settings_Output_ch2.Visible := false;
   frmRegulering.sbtnAlt2Settings_Output_ch2.Visible := false;
   frmRegulering.sedAlt2Settings_Output_ch.Visible := true;
   frmRegulering.lblAlt2Settings_Output_ch.Visible := true;
   frmRegulering.SpeedButton34.Visible := true;
   frmRegulering.lblAlt2Settings_Output_ch.Caption := 'Output channel:';
   ActiveChannels;
end;

procedure TfrmRegulering.speOpt2_typereg_PIDClick(Sender: TObject);
begin
   frmRegulering.grbOpt2_onof_setpoints.visible := false;
   frmRegulering.grbOpt2_onof_parameter.visible := false;
   frmRegulering.grbOpt2_dopa_setpoints.visible := false;
   frmRegulering.grbOpt2_dopa_parameters.visible := false;
   frmRegulering.grbOpt2_PID_setpoint.visible := true;
   frmRegulering.grbOpt2_PID_parameters.visible := true;
   frmRegulering.grbOpt2_feedback_setpoint.visible := false;
   frmRegulering.grbOpt2_feedback_parameters.visible := false;
   frmRegulering.lblAlt2Settings_Output_ch2.Visible := true;
   frmRegulering.edtAlt2Settings_Output_ch2.Visible := true;
   frmRegulering.sbtnAlt2Settings_Output_ch2.Visible := true;
   frmRegulering.sedAlt2Settings_Output_ch.Visible := false;
   frmRegulering.lblAlt2Settings_Output_ch.Visible := false;
   frmRegulering.SpeedButton34.Visible := false;
   frmRegulering.lblAlt2Settings_Output_ch.Caption := 'Output channel:';
   ActiveChannels;
end;

procedure TfrmRegulering.sbtnAlt1Settings_Output_ch2CalibrationClick(
  Sender: TObject);
begin
  if frmRegulering.grbOxygen_Calibration_output.Visible = false then
    begin
      frmRegulering.grbOxygen_Calibration_output.Visible := true;
      frmRegulering.grbOxygen_Calibration_output.BringToFront;
    end
  else if frmRegulering.grbOxygen_Calibration_output.Visible = true then
      frmRegulering.grbOxygen_Calibration_output.Visible := false;
end;

procedure TfrmRegulering.sbtnAlt2Settings_Output_ch2Click(Sender: TObject);
begin
  if frmRegulering.grbOxygen_Calibration_output.Visible = false then
    begin
      frmRegulering.grbOxygen_Calibration_output.Visible := true;
      frmRegulering.grbOxygen_Calibration_output.BringToFront;
    end
  else if frmRegulering.grbOxygen_Calibration_output.Visible = true then
      frmRegulering.grbOxygen_Calibration_output.Visible := false;
end;

procedure TfrmRegulering.sbtnpH_Calibration_inputClick(Sender: TObject);
begin
  if frmRegulering.grbpH_Calibration_input.Visible = false then
    begin
      frmRegulering.grbpH_Calibration_input.Visible := true;
      frmRegulering.grbpH_Calibration_input.BringToFront;
    end
  else if frmRegulering.grbpH_Calibration_input.Visible = true then
      frmRegulering.grbpH_Calibration_input.Visible := false;
end;

procedure TfrmRegulering.sedAlt2Settings_Input_chChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.sedAlt2Settings_Output_chChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.sedILTchannelChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.sedMetRelChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.sedPHchannelChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.sedPHrelChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.sedPHsyreRelChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.sedtAlt1Settings_Input_chChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.sedtAlt1Settings_Output_chChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.sedTEMPchannelChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.sedTempRelChange(Sender: TObject);
begin
ActiveChannels;
end;

procedure TfrmRegulering.SpeedButton23Click(Sender: TObject);
begin
  if frmRegulering.grbpH_Calibration_outputAcid.Visible = false then
    begin
      frmRegulering.grbpH_Calibration_outputAcid.Visible := true;
      frmRegulering.grbpH_Calibration_outputAcid.BringToFront;
    end
  else if frmRegulering.grbpH_Calibration_outputAcid.Visible = true then
      frmRegulering.grbpH_Calibration_outputAcid.Visible := false;
end;

procedure TfrmRegulering.SpeedButton25Click(Sender: TObject);
begin
  if frmRegulering.grbOxygen_Calibration_input.Visible = false then
    begin
      frmRegulering.grbOxygen_Calibration_input.Visible := true;
      frmRegulering.grbOxygen_Calibration_input.BringToFront;
    end
  else if frmRegulering.grbOxygen_Calibration_input.Visible = true then
      frmRegulering.grbOxygen_Calibration_input.Visible := false;
end;

procedure TfrmRegulering.speOxyAnalogClick(Sender: TObject);
begin
  if frmRegulering.grbOxygen_Calibration_output.Visible = false then
    begin
      frmRegulering.grbOxygen_Calibration_output.Visible := true;
      frmRegulering.grbOxygen_Calibration_output.BringToFront;
    end
  else if frmRegulering.grbOxygen_Calibration_output.Visible = true then
      frmRegulering.grbOxygen_Calibration_output.Visible := false;
end;

procedure TfrmRegulering.SpeedButton29Click(Sender: TObject);
begin
  if frmRegulering.grbFeed_Calibration_output.Visible = false then
    begin
      frmRegulering.grbFeed_Calibration_output.Visible := true;
      frmRegulering.grbFeed_Calibration_output.BringToFront;
    end
  else if frmRegulering.grbFeed_Calibration_output.Visible = true then
      frmRegulering.grbFeed_Calibration_output.visible := false;

end;

procedure TfrmRegulering.SpeedButton30Click(Sender: TObject);
begin
  if frmRegulering.grbLight_Calibration_output.Visible = false then
    begin
      frmRegulering.grbLight_Calibration_output.Visible := true;
      frmRegulering.grbLight_Calibration_output.BringToFront;
    end
  else if frmRegulering.grbLight_Calibration_output.Visible = true then
      frmRegulering.grbLight_Calibration_output.Visible := false;

end;

procedure TfrmRegulering.SpeedButton31Click(Sender: TObject);
begin
  if frmRegulering.grbAlt1_Calibration_input.Visible = false then
    begin
      frmRegulering.grbAlt1_Calibration_input.Visible := true;
      frmRegulering.grbAlt1_Calibration_input.BringToFront;
    end
  else if frmRegulering.grbAlt1_Calibration_input.Visible = true then
      frmRegulering.grbAlt1_Calibration_input.Visible := false;
end;

procedure TfrmRegulering.SpeedButton32Click(Sender: TObject);
begin
  if frmRegulering.grbAlt1_Calibration_output1.Visible = false then
    begin
      frmRegulering.grbAlt1_Calibration_output1.Visible := true;
      frmRegulering.grbAlt1_Calibration_output1.BringToFront;
    end
  else if frmRegulering.grbAlt1_Calibration_output1.Visible = true then
      frmRegulering.grbAlt1_Calibration_output1.Visible := false;
end;

procedure TfrmRegulering.SpeedButton33Click(Sender: TObject);
begin
  if frmRegulering.grbAlt2_Calibration_input.Visible = false then
    begin
      frmRegulering.grbAlt2_Calibration_input.Visible := true;
      frmRegulering.grbAlt2_Calibration_input.BringToFront;
    end
  else if frmRegulering.grbAlt2_Calibration_input.Visible = true then
      frmRegulering.grbAlt2_Calibration_input.Visible := false;
end;

procedure TfrmRegulering.SpeedButton34Click(Sender: TObject);
begin
  if frmRegulering.grbAlt2_Calibration_output1.Visible = false then
    begin
      frmRegulering.grbAlt2_Calibration_output1.Visible := true;
      frmRegulering.grbAlt2_Calibration_output1.BringToFront;
    end
  else if frmRegulering.grbAlt2_Calibration_output1.Visible = true then
      frmRegulering.grbAlt2_Calibration_output1.Visible := false;
end;

procedure TfrmRegulering.SpeedButton8Click(Sender: TObject);
begin
  if frmRegulering.grbTemp_Calibration_input.Visible = false then
    begin
      frmRegulering.grbTemp_Calibration_input.Visible := true;
      frmRegulering.grbTemp_Calibration_input.BringToFront;
    end
  else if frmRegulering.grbTemp_Calibration_input.Visible = true then
      frmRegulering.grbTemp_Calibration_input.Visible := false;
end;

procedure TfrmRegulering.SpeedButton9Click(Sender: TObject);
begin
  if frmRegulering.grbpH_Calibration_outputBase.Visible = false then
    begin
      frmRegulering.grbpH_Calibration_outputBase.Visible := true;
      frmRegulering.grbpH_Calibration_outputBase.BringToFront;
    end
  else if frmRegulering.grbpH_Calibration_outputBase.Visible = true then
      frmRegulering.grbpH_Calibration_outputBase.Visible := false;
end;

procedure TfrmRegulering.speFeedDPClick(Sender: TObject);
begin
  frmRegulering.gpbFeedDPSet.Visible := true;
  frmRegulering.gpbFeedDPA.Visible := true;
  frmRegulering.gpbFeedOOSet.Visible := false;
  frmRegulering.gpbFeedOOA.Visible := false;
end;

procedure TfrmRegulering.speFeedOOClick(Sender: TObject);
begin
  frmRegulering.gpbFeedDPSet.Visible := false;
  frmRegulering.gpbFeedDPA.Visible := false;
  frmRegulering.gpbFeedOOSet.Visible := true;
  frmRegulering.gpbFeedOOA.Visible := true;
end;

end.
